<template>
  <div class="photoInfoContainer">
    <h3>{{photoInfo.title}}</h3>
    <p class="subtitle">
      <span>发表时间：{{photoInfo.add_time|dateFormate}}</span>
      <span>点击：{{photoInfo.click}}次</span>
    </p>
    <hr>
    <vue-preview :slides="slide1" @close="handleClose"></vue-preview>
    <div class="content">
      <p>{{photoInfo.content}}</p>
    </div>
    <cmt-box :id="id"></cmt-box>
  </div>
</template>
<script>
import comment from '../subVue/comment.vue'
export default {
  data(){
    return {
      id:this.$route.params.id,
      photoInfo:{
        id:43,
        title:'清新有活力的办公室设计',
        click:3,
        add_time:Date.now(),
        content:'古特雷斯还说，他曾经问过是否可以出售秘书长官邸救急。这大概是句无奈的玩笑话了，因为根据联合国与总部所在地美国签署的协议，秘书长无权“卖房”。'
      },
      slide1: [
        {
          src: 'https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_b.jpg',
          msrc: 'https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_m.jpg',
          alt: 'picture1',
          title: 'Image Caption 1',
          w: 600,
          h: 400
        },
        {
          src: 'https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_b.jpg',
          msrc: 'https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_m.jpg',
          alt: 'picture2',
          title: 'Image Caption 2',
          w: 1200,
          h: 900
        }
      ]      
    }
  },
  methods:{
    getPhotoInfo(){
      this.$http.get('/api/getimageInfo/'+this.id).then(ret=>{
        this.photoInfo=ret.body.message
      })
    },
    handleClose () {
      console.log('close event')
    },
    getPhoto(){
      this.$http.get().then(ret=>{
        if(ret.body.status==0){
          ret.body.message.array.forEach(item => {
            item.w=600;
            item.h=400;
          });
          this.slide1=ret.body.message
        }
      })
    }
  },
  components:{
    'cmt-box':comment
  }
}
</script>
<style lang="scss" scoped>
.photoInfoContainer{
  padding: 3px;
  h3{
    font-size: 20px;
    text-align:center;
    color: #226aff;
    margin: 15px 0;
  }
  p{
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    line-height: 10px;
  }
  .content{
    p{
      font-size: 15px;
      line-height: 30px;
    }    
  }
}
</style>

